﻿using System.Windows;
namespace TimersXP
{
    /// <summary>
    /// This is the core of the application it will keep track of global settings, configurations, options, Skins paths, skins libraries,
    /// and all the other stuff that determines how the program will be used and look.
    /// </summary>
    /// <NOTE>This is a Sealed class therefore that makes this a singleton class.</NOTE>
    public sealed class ModelCore
    {
        /// <summary>The TimersCore singleton object.</summary>
        private static readonly ModelCore modelCore = new ModelCore();

        /// <summary>The skins library</summary>
        /// <NOTE>In the future the Skins might contain many different sub-libraries, and perhaps meta-data for skin genre's and skin categories or themes!</NOTE>
        /// <NOTE>But all of the skins should be broken down into this one skins library.</NOTE>
        private Skins skinsLibrary = new Skins();
        /// <summary>The timers host window, needed here so the ViewModel can set it's TopMost property to true or false!</summary>
        private Window timersHostWindow = null;

        #region Constructors
        /// <summary>Prevents a default instance of the <see cref="ModelCore"/> class from being created.</summary>
        /// <NOTE>This is the constructor for the singleton class.</NOTE>
        private ModelCore()
        {
            //<MenuItem Tag=".\Resources\Skins\BlackSkin.xaml" IsChecked="True">
            //    <MenuItem.Header>
            //    <Rectangle Width="120" Height="40" Fill="Black" />
            //    </MenuItem.Header>
            //</MenuItem>
            //<MenuItem Tag=".\Resources\Skins\GreenSkin.xaml">
            //    <MenuItem.Header>
            //    <Rectangle Width="120" Height="40" Fill="Green" />
            //    </MenuItem.Header>
            //</MenuItem>
            //<MenuItem Tag=".\Resources\Skins\BlueSkin.xaml">
            //    <MenuItem.Header>
            //    <Rectangle Width="120" Height="40" Fill="Blue" />
            //    </MenuItem.Header>
            //</MenuItem>

            SkinItem skin1 = new SkinItem("BlackSkin", "BaseSkin", "D:\\Temp2\\");
            SkinItem skin2 = new SkinItem("GreenSkin", "BaseSkin", "D:\\Temp2\\");
            SkinItem skin3 = new SkinItem("BlueSkin", "BaseSkin", "D:\\Temp2\\");

            skinsLibrary.AddSkin(skin1);
            skinsLibrary.AddSkin(skin2);
            skinsLibrary.AddSkin(skin3);
        }
        #endregion Constructors

        #region Properties
        /// <summary>Gets the timers core.</summary>
        /// <returns>The Timers Core</returns>
        public static ModelCore GetModelCore() { return modelCore; }

        /// <summary>Gets or sets the skins library.</summary>
        /// <value>The skins library.</value>
        public Skins SkinsLibrary
        {
            get { return this.skinsLibrary; }
            set
            {
                if (this.skinsLibrary != value)
                {
                    this.skinsLibrary = value;
                    //OnPropertyChanged(() => this.SkinsLibrary);
                }
            }
        }

        /// <summary>Gets or sets the timers host window.</summary>
        /// <value>The timers host window.</value>
        /// <NOTE>Needed so the Timers Host View Model can set the windows TopMost property to true or false.</NOTE>
        public Window TimersHostWindow
        {
            get { return this.timersHostWindow; }
            set 
            {
                if (this.timersHostWindow != value)
                    this.timersHostWindow = value;
            }
        }
        #endregion Properties
    }
}
